// @ts-ignore
import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {ButtonSizeType} from '../../enums';


/**
 * name: 按钮名字
 * type: {
 *     primary，
 *     default，
 *     danger，
 *     link
 * }
 */
@Component({
  selector: 'dhl-confirm-button',
  templateUrl: './dhl-confirm-button.component.html'
})
export class DhlConfirmButtonComponent {


  defaultClass = `${ButtonSizeType.DEFAULT}-button`;
  buttonClass = this.defaultClass;
  @Input() loading = false;
  @Input() content = 'comfirm';
  @Input() popIcon = ' ';
  @Input() position = 'top';
  @Input() show = true;
  @Input() name = 'button';
  @Input() type = 'primary';
  @Input() icon = 'question-circle';

  @Input()
  set disabled(value) {
    this.buttonClass = value ? this.buttonClass + ' disable-button' : this.buttonClass.replace('disable-button', '');
  }

  get disabled() {
    return this.buttonClass.indexOf('disable-button') > -1 ? true : false;
  }

  @Input()
  set sizeType(value) {
    this.buttonClass = this.buttonClass.replace(this.defaultClass, '') + ` ${value}-button`;
  }


  @Output() okClick = new EventEmitter();


  cancel() {

  }

  triggerClick() {
    this.okClick.emit({value: 'triggerClick'});
  }


}













